Refactoring the profiler to work.