Added closure function functionality