Removing duplicate code - Fixing domain creation to use a cache of already created domains