Fixed logic so that it's not splicing the original array