Working perceptron trainer code and some basic features.