refactor and clean up tracer