set up imperative loop & iteration function