Neatened up code