roxygenized documentation. add new function (map) for future developing. minor modifications to R code.