Adding iterator to access query result