Refactor out the agony code for distribution in class.