accept and sample loop