use array.splice instead