function simplifications fixes
Using unique_function