Use more flexible way of specifying the function in preparation for async functions.
Add experimental support for async functions.