converted main.js to a self-execuuting function, protecting $ variable associated with jQuery