wrote the reader functions