tidied up some code
added pacakge docs