Tidy up, measures organised, tests fixed
Docstrings, hat filter, code tidy