Refactored to use the new exceptions