measure function works