Fixed point 1 and 2 of Marco's email. Put back mclapply
fixed some bugs
minorstuff