move the document write to index.html