towards resizing logic (not yet finished).