Serious tidy of JS and resource dependencies