added code for closure[ crude but works ] :D