Improved javascript snippets.