Moved init/drawing code into js file from html file