Code refactored to use namespaces. Close #7 . Related to #3