Fixed some closure related problems and added a benchmark.