clean functor implementation