Working code for game