rewrote FunctionWrapper to work with std::function. fixes #2