Refactor namespaces and sets