Incorporated Adam's changes