updated jquery, refactored code