some refactoring and UI loveliness