Revert "Re-added backtracking and memoization."

This reverts commit ac8529c9f55da7fdc1186e3f34313cf411de6e71.