Changes to make it CRAN ready