Implemented better handling of namespaces