heap cleanup
cleanup stack
More robust dynamic resize logic
Add and validate dynamic resize logic