Reformat custom.js; also wait until the document is ready for all manipulations