Refining html and javascript snippets