Changes to make it a jQuery plugin