Modified some bits to be compatible with my own toolbox.
Fixed missing \n's in trace.