Join start and endpoint generation to single function