Changed back function to use JQuery