Corrected bugs of the TypeRegistry.
Moved core files to own namespace.