Add doctests and many tests