further refactoring in preparation for update.