Added non efficient backtrack solving mode that finds optimal solution