Rewrote FunctionWrapper to work with std::function. Fixes#2