Minor bugfixes, and enhancements to allow integrating with this module from other modules.