updates to traintest

moved descriptions to .h.
test and train now correctly free resources when an excpetion is caught.