Refactored to introduce the player class