Change from ~-pointers to the new Box<> syntax
Remove a few unnecessary heap allocations