Added support for custom functions