Refactor to make exceptions a bit more clear.