neatened code for PR