Finished perceptron code