FEATURE: Refactor to use namespaces, add unit tests