Changed occurrences of function and closure to have right number of parameters, please verify this is correct