Clean up measure implementation, and add an improved test case.
Use 1.8 compatible syntax