Some refactoring in UI, more needed but it's late