Use unique_function were appropriate