While I hope you never receive code this bad, we are going to walk through what is needed to turn even this into readable, maintainable, and fully tested code. The best part, the part you aren't going to believe, is that transforming this code is actually safe and fairly easy.