Work in progress still for the training algorithm.