Couple of changes to tidy up the code.
'ds.glm' largely amended and thorough checks enabled.