cleanup remove duplicate code