Tweak formatting.
Make all custom exceptions inherit from main custom exceptions.
Use exceptions for critical error handling instead of exiting.
Handle regex syntax errors gracefully.
Tweak formatting.