looking good so far, need to figure out array indexing in outer for