reworking to use of exceptions