updated javascript snippets