refactoring and cleaner handling of the player state