refactoring player functionality out of game.js