reorganize code, pulling the per-codon-site loop into its own function