Serious refactoring of the UI code (unix)