Lots of fixes and a few new things