Using a timer for running the main game loop