finish first two thread functions
implement first two threads (read and search)