Simplify namespaces. Make internal classes private
Add efficient count operation