BTW, I'd rather avoid most mixed declaration and code, so maybe you could put this higher in the function body? thanks :)