Moving javascript from index.html to here, see issue #41