Many tweaks to the learning algorithm