better iteration but not working right