More accurate determination of duration; Fixed issue calculating visits; Broke
line-durations-and-revisits into smaller functions