Refactored to jQuery