Fix bug related to interpolating a distance between two points.
Clean some of the code in components