Added some doctests and new documentation