Refactoring and implementing some UI