Fixed closures issue

Added support for closures