Refactor domain code.