Feature/tahrir database improvements

These are some changes I made in the course of developing Tahrir this week. The API still needs cleanup, but this stuff is stable enough for a new PyPI release.