now use querycollection object instead of arraylists
improved use of querycollection