Large scale refactoring to make defensive stats easier