convert sub into a functor