Added bezout for polynomials and fixed more bugs.