Created separate methods for forward and back propagation