Fouling and retention of nanofiltration membranes