Don't use pop() but slice() to not mutate the array