better resizing handler + other improvements