more consolidation of code