Added readIndex and writeIndex methods