Added distance measurement to view. Refactord