Made some changes as per Adam's comments