Refactor it - optimzized breadth first by dedupping solution space