added some documentation
added lots of rdocumentation, resolves #2