code shortened with the use of .end() function