copy over lots of changes from "shrink" branch.