value splicing into array at proper index