functional refactoring of player class