cleaned up namespaces, refactored some classes for readability/modularity