Characterization and optimization of SiO2 and Si3N4 thin films