tidied up and removed repitition