refactoring and adding skip code to the profiler when profiling is disabled