latest changes to chapter 4 code.... still broken NN search task