Refactoring. Changes to error handling, thread-related debugging.
Changes to application - mostly refactoring