free loop rewrite