refactored to include jquery