added a resize function.