Decouple script from HTML, closes #1