had to change end variable from len - i, to i - 5.