created a function that measures VI