Completed measuring code