VID-1499 move processing into 1 loop