Re: Code Review
I'm quite sure that's code from a Delphi developer. You'd be surprised how many of them write code like that. Once I was assigned an application to manage insurance agents for a large insurance company, written in Delphi.
Each release I made added new features and code shrinked, up to the point the people installing it on the insurance company PCs asked me why each new version they were installing was actually smaller than the previous one - they were expecting the opposite..
The reason is for each release I started first by heavily refactoring the old code of the portion I was going to modify, and eliminating all the duplicated and truly useless stuff (to ensure it coudn't bite back)... the bad thing of easy-to-use progamming languages and tools it's they give access to development to a lot of people with very little clues about true programming best practices - and cut&paste is the quick way to add new code, isn't it?
At least then there was no stackoverflow and "developer" blogs, and thereby there were less of the s*****y code I see today blatantly copied from some other clueless developer... regardless of how many "meee toooo" votes it got.