refactored to utilize JQuery