Improved the JQuery part a bit.