Added new mode and better diastance calc