Partial commit
Finished refactoring of measurement.