added the lastCompleted endpoint and function