Fleshed out main game loop