Clean up perceptron code