Restructured to pass CRAN check