break this into two loops