The code for this is almost similar to that in set_size - would be nice to make it a function.