moving predicate and consumer functions into specific classes and doing cleanup