Added calculation of distance measures