Convert to throw exceptions instead of exit(..)ing