Replace callbacks with std::function