use generator instead of list