using std::function (faster, less code)