Now working as a JQuery plugin