More refactoring to use mutable structures.