It's time to get serious
Then, rewrite the whole algorithm. Adding things that are already done is just pointless.
Mixing styles, algorithms is also pointless, not to say hazardous.
Being serious is also communicating with the code authors before thinking you know better
than them.
Being serious is also reviewing code when asked. Should I say how much time I wasted in
that function? It could have been used elsewhere.
To end that: rewrite the function. Completely. Get rid of old code, it won't be any
use here as it doesn't match proper coding style. I won't maintain this function
until your complete rewrite is over.
I'm done here.