main script task.R changed - removed a nmax loop