added support for local functions