UI fixes, refactoring.