create resize function