fixed some memory leaks
fixed tests
Merge pull request #174 from hal3/master

imperative searn short and sweet, fixed memory leaks, and tests