refactoring zen.type for self-hosting