Add foreach functionality