added header row and neatened code