Removed jquery and refactored code