Speeding Up Doug's Solution with the Profiler