moved some player-related code into player controller