Inlined duplicate handler to reduce the number of threads.