working fot each and if