moved things around
npoints added as a cl argument