Make a helper function for creating a callback