The newest version works much better, thanks! IMHO the main remaining problem is that it still changes commas into semi-colons on the procedure declarations which is weird and not very idiomatic.
Also, is there a way to temporarily disable the formatting on a section of the code? This is sometimes handy when you must use whitespace to align data to make it easier to understand (e.g. with large matrices or things like that).