refactored game menu code and fixed a bug