Polynomial class implementation