Refactor and clean ns namespace