adding profiling code