Modified replace.
Can modify items using a negative index, an exception is thrown when the index is out of bounds.