Refactors domain.module to use service classes.