Better exception handling, simpler test