ktrace test and code cleanup