Refactor movement update function (#225)