refactored ClientApplication to prevent try nesting and System.exit()