Comparators rewrited using lambdas
Factory added.
Minor fixes