Misc

Some cleanup, a couple of new useful methods, and don't raise Exception, instead raise a more appropriate subclass, such as RuntimeError.