Enhancing performance of optical sensor through the introduction of polystyrene and porous structures