refactoring js/jquery client side code.
weekly refactoring. Cleaned some code everywhere