refactor player code
refactor player code