Final commit of the day. Fixed learning algorithm.