Eliminated the problem with error message when granularity vector was used. In addition, started to document functions with roxygen2 syntax.