Some refactoring of the main application class