dynamic resizing: updates and code refact