somes functions needs to keep persistant data. At present those variables must be declared at top level of the file. One should be able to declare static variables in functions to reduce scope of those variables.
But I'm not convince that should be done inside loop structure.