I'd say don't bother - this code is already a huge mess enough to require a full rewrite anyway.