duplicate code cleanup