adds tracing
adds check for remaining input.