replace=TRUE for random sampling (otherwise can't sample > 255 times)
minor changes to scripts, seemingly working now