Improved mapoptimizer