Updated javascript snippets