updated ui and refactored some code