Fixed writeHTML. Edited but still unsure about writeJS