Modified splice logic since it was deleting the other entry in the table