Breaking apart monolithic js in index