DRYed up code and fixed profile spec bug