Use splice correctly to remove only one element at a time