before loop