Fix package, ok for R CMD check - ongoing debug for main function