Refactor namespace to support db connection