ABI cleanup

Improves some code and removes a bunch of unnecessary code.

Someone should test on Windows.