Where is the 'while' which matches your 'do' ?

Also, use [code][/code] tags when posting code.