added closure support
added documentation for closure