added some loop stuff