Refactor and add documentaiton to namespaces