Refactored functions

Refactoring of some functions to make it easier to start executing a trace or to stop tracing