further code consolidation