Added backtracking functionality to the Heurakles algorithm and did some
cleanups / refactoring