Changed internal query result sets to dict