Reverted direction generation code.