Made resize() recursive