Added isOnMainPath func + tests.