don't import traceback until it's needed, and some cleaning