improve js snippets