added getBufferPastValue function that takes an index and returns a value