moved everything into namespace, refactored