added prepare function to turn array into tuple of first, second, rest