Move functions in another file and refactor InsertNamespaceCommand
Add unit tests for namespace.py