I suspect you couldn't. The problem with systems like this is their requirements aren't documented anywhere, and it can be dicey looking at current code behavior, because often what's there is just what the developer came up with through lack of specs. Frequently, these kinds of codebases come about because critical members of management inherently don't trust best practices and believe they will take longer, so they'll pressure you to create crap and imagine if you don't, if you had it would have been quicker.