handled loops in with lists and maps