refactoring in preparation for making a recursive decorator