Added closure to generate action functions