added a little profiling code