Added error function to backpropagation function