Revert "Revert "Better resizing""

This reverts commit ba329322719d6a0198680d08dca110dc8a85e0e8.