Improvements to Javascript snippets by Vangelis Tsoumenis