Added resizing logic