Refactor packages and namespaces