Refactored all player movement code to use one function