Making a general processing function with create_function