replace ugly class by a beautifull lambda&unique_ptr