Rewrote salvaging more generally

I assume that salvageRef will be imported from the main class as this class imports the main class up the top (if it doesn't, please fix ;3). I haven't tested changes, but as I haven't done anything too unusual, it should all work. Hopefully.