Filling perceptron function and cleaning code