20130317 1600 workprogress
All functions documented
pass R CMD check