perceptron learning, refactoring, tests, stuff still doesnt work