added some loop functions