More fixes, tidyings and clean ups to the module.