change javascript file structure to require dependencies within each sub...

... file