reformat code
add getTrace method