removed comments, fixed rewind()