Changed loop ordering to eliminate ghosting even more.