implementation of basic resizing