implemented path correction and detection
tests pass, need to write more tests