Implemented untested version of direction vector correction code.