Move the array handling logic into `add`