Added an HTML test page and made script more solid (error proof)