Added trace() function