Applied state changing function in wrong spot.