Handling the case of first and last visit on the timeline.