adding docstring usage tests, fixing some error checking