Moved writeGeneList out to JavaScript

And moved some other JS functions to dedicated JS files.