Many changes by Chalom and Oliveira: 1st version in CRAN.