The Influence of Microstructure, Impurities and Environment on SiOx ReRAM