Improved the Javascript Map