dynamic resizing now working correctly