More UI improvements and refactoring.