primitive nested loops working