chnage to functor implementation