find_end now takes predicate, added additional test to verify predicate works