Moved some implementation details to separate namespaces