Trying to implement Array_splice