refactored with namespaces