reorganize some copypasted functions, and begin working on more alignment sampling on trees