use while loop for processing, track remaining