Don't create functions in loop.