Updated to be backwards compatible with jQuery 1.4.4