modified generatePicture()