Simplification and style fixes. Still need to deal with __reduce__() method.