A host of small bugfixes being rolled into this feature branch