Modified to cope with functions that return a const something.