some refactoring and redesign. ui-elements needs to be cleaned up a little