Fixed a logic bug in the choose-attribute algorithm. Also make the computation of new examples/targets more clear and efficient