lots of changes making the library a little more pythonic