Moved logic for moving forward to the moveForward function