Add regression tests, replace with your own code. or quit.
Only noobs like myself years ago would go ahead and refactor a lot of code during work hours without a good reason.
However when you stumble through something and finally understand the idea behind it (good or bad) then it might be a good time to add a couple of tests.
And when you have a few tests that covers nearby code you can hopefully find the courage to make a few surgical cuts to remove the worst tumors. ;-)