rewrote FunctionWrapper to work with std::function