implemented seek (with some bugs)