Added flexibility to add predicate for custom conditions.