Major refactoring of measurement, etc.
Measurement update