small refactoring on reverseDirection