gameloop functions refactored