Some small cleanup and uniformisation arround the new createFunction() API