Refactor exceptions and containers.