Update Main Game Code

There are some erros in this code.