Major refactor, using namespaces