changed how to compute the transition matrix. This owes a lot to Mr.Oyama's program