I think you actually want to splice here instead of having a dirty array.