Refactored to use namespaces