Created attachment 15188 [details] [review]
Also some minor cleanup by declaring variables and functions used in
a single file as static.
Created attachment 19452 [details] [review]
Make the old patch more current and also fix some indents and converted most tabs to 4 spaces
Already corrected in git master.