Adding preliminary support for user-supplied functions.