added gameLoop function