Changed to jQuery plugin