refactored code, updated UI