Added offset stuff to read()

and added useful debugging stuff