store trace depth

also, some renaming for consistency