Refactoring and JQuery adoption