Controlling oxygen vacancies and properties of ZnO