Refactored code, updated UI