Stabilizing CsPbI3 perovskite for photovoltaic applications