Updating UI, refactoring