fixed a few bugs in the user interface and did some refactoring