Added many little features and tweaks to NN learning algorithm