added resizing code