Cleaned up game loop and added some input error checking