GUI improvements and some refactoring