added dynamic resizing + various fixes