Preparing for efficient algorithm refactoring + fixed backtrack algorithms bug