Reimplemented \classification logic, fixing some bugs.