updated polynomial class and changed the order of the terms to large to smallest