updated docs and added doctests

 and fixed last line