domain code cleanup