refactoring of polyclassifier

See commits.