updated to run measurement when clicked