it should be easier the way ianb suggests - just take the resize line out of "process" and put it after the input and before the process stuff is called.
[edit]
btw, if you edit your first post and click "go advanced", you can edit the thread title on your own