separated sam related func from aln and be a independent module