Renamed variables
Get rid of std::function cause it is allocating memory on heap. Replace it by a simple template functor