major refactoring due to namespace changes