Added dir var to store the direction of the trip and be able to skip wrong steps in the correct direction