Not sure if it's a genuine question but I'll try to answer, I think when worms detect vibration they associate it as rain, that is why they go up ground to prevent drowning.
Edit: I got curious and it turns out my assumption was false, looks like it might be because it's easier to migrate, then there is also to avoid predator.
https://www.scientificamerican.com/article/why-earthworms-surface-after-rain/
Or you do the right thing re-write or refactor, apply the latest practice add some tests to it. This way you won't have a black box anymore. Who knows there might be a hidden bug there that might be a huge security issue and could bite you back in the future.