Implemented lazy fetching for query results