Updated with recent commits from aliasaria

Looks like this one's going to have more than a couple conflicts with the Sandstorm port, but most of it should work.