refactoring polynomial according to the api change