added loop support