replaced nrep() with nreps()