calculate length between points instead of hardcoding