Added default exception handling to the application.
Added debug flag to the application.
Implements #4.