Added a way to calculate  positions in a line