added support for custom functions