Implemented the IO part of query evaluation