handle resizing better