put printall at the begin of the loop