cleanup dig code