Making resize function