Refactored Ui, added javadocs for something