Do not create functions in loops