Updated Backtracking

Works in some cases now, still not in others. Cleaned up algorithm by
making a CheckConstraints function (to be used in future algorithms as
well)