Minor refactoring and UI cleanup