added code to make updating deltas and updating weights