Used bitsets to optimized domains. Mutated a single state instead of
repeatededly copying states when backtracking.