Made the measure script a little more flexible.