use seq_along() in place of seq_len(length())