added dynamic resizing