added extract_loops.py