You seem to have inherited code from a maniac, but if the code works reliably, you may be well-advised to leave it as it is. The alternative would be fully refactoring it, rather than just cleaning up the odd idiom while leaving the essential horror in full bloom. If you'll be expected to add substantial chunks of functionality going forward, I would certainly write much better code than the old guy did. Maybe the refactoring would be a suitable question for
s/w engineering. Here, it would be off topic. —
Ed Plunkett 29 secs ago