Added doctests to functions and classes.