Refactor movement controller