Tidy up the code, and implement translations for domain definitions and types.