Use std::function, uniue_ptr, remove deprecated macros