Euclidean method adjusted. Math formula updated.