Some additional jQuery functionality. Edit logic fixed.