Refactoring out the actual implementation of the javascript generation into own library files.