Relations are filtered but small problem with relation inner loops
Inner loops fixed