polynomial: major cleanup (still WIP)
polynomial: another major refactoring (still WIP)