added heuristic to exclude answers generated from infinite loop