Rework the JS file structure