Refactor measures (work in progress).