minor changes to reduce lines in jQuery, same functionality