Refactor Solution.shrink and Solution.unshrink