Lots of random fixes and implementations.