Cleaner exceptions

Merge after #131.