fixed calling closure functions.
added support for function declarations.