created based on CRAN package