abstraction for microloops
some tweaks