Changed resize function