Trying to reproduce the Bains learning procedure