Implemented formal polynomials arithmetic and small fixes in the
context handling.