Improved duplicate name handling.