Refactoring on perceptron_with_bias