almost implemented the factorgraph, good.