simplified code for jQuery