added singletons recognition to main search algorithm