moved js to main.js and moved chained function within main.js;