Changed the learning error handling so that it is more efficient ( #49 )