just a little code refactorization

Refactored the code in an attempt to make the namespaces, etc consistent. Also removed unused references.