Adding domain types, refactoring.  Domains not being properly recognised yet