Improved the Javascript script.