Refactor namespace determination in ModelBuilder