Several enchancements to game loop