Simplify movement functions into a single function