added a pretty barebones version of read()