Added a short training set for debug and fixed classification algorithm. Also added some features from plugins.py.