work on smart resizing