Issue #178: Make the support for measurements more extensible
First step, moving into a separate module