refactor entity movement to use fewer functions