Added auto-resize code.