refactored code and changed some text in ui