Rationaization: Why's the code written that way?
Having worked on many rewrites, I often use The Roast was Too Big for the Pan analogy to explain why we need to understand why the code was written the way it was rather than parroting the system we are rewriting.
It's not necessarily safer to copy existing algorithms, because there are often interdependencies (read: kludges) between different steps of a long chain of calculations or transformations.
You need to make a conceptual model of the current system and then abstract the total effect of all the variables to really understand what is going on. This is a process called rationalization.
Take the time to really understand the algorithms and you will be much further along the road of both ending up with a working system and having a new system that is far more maintainable than the previous one.