Added duplicate ID error checking.