Cleaner averaged perceptron implementation