Fix namespacing issue
Refactoring of the code