cleaned up domain code