added ability to control loops