fixed error in training function, and made benchmarking function.