Refactored code to remove jQuery usage.