First working version of the classifier. Still needs much work.