Worked setState method