Use std::function instead of SharedFunction