refactored some consumer code