Fixed a ton of stuff

Can somebody once again confirm that this passes all doctests; it does
now within PyCharm