so the fact that your tail is in reverse order is incredibly weird and i think you should call .reverse on it at the end of the block, and also leave a comment that explains "these went into the array in reverse order so we make them frontwards again"