Added reading to buffer and seek function