Rewrote the algorithm for computing the Poincare polynomials