PANI-TiO2 composites: the mechanism behind a green process