Andrew classify

This updates the older classify pull request to be less intrusive and fix some minor issues with it.