more work finished
Added namespaces, minor refacts