Changes to resize function