Modified to use the profiler, needs to be better written and remove hardcoded references