I understand you might choose not to tackle this case... but it is a common idiom to to put global statements at the start of functions, and this seems to break the rule of having size() as the first thing...

(As I know what is going on I had no trouble reordering...)