added rdoc and some improvements