Refactoring to support better UI