Fixed problems with read mark. Deleted unused code