Sample at most 1000 sequences.
Combine some intermediate steps.