Please don't define functions in closures. It makes code hard to debug.