Refactors jquery code, splits it into modules