update counting and sieve to iterate over arrays and maps