I made a few changes

-Made the right and left function not inverted.
-Took halts out of functions because they are useless.