Refactored exceptions, reformat