Got rid of embedded loop. It was just causing issues.