btw: I'm not sure it makes sense to run two loops here