this loop doesn't seem to do anything? maybe the one below should be nested.