jQuery Changes

Added in some improvements to the jQuery code.