changing callback type to std::function, to make it build with C++11 standard on MSVC.