refactor state update and player controller