change way resize function works