Refactoring moveForward and mmoveBackward

I changed this two function

please, review them.

Thank you