Remove nestled loops, Fix exclude