Revert "Lots of fixes and a few new things"

This reverts commit 356fc51d8528df940f08d8583fb357ec9faa1c8e.