Imported from refactor branch. Conservative refactoring of
box array to reduce memory.