Corrected new id logic