Added profiling code