added proper resizing