Some more refactoring in the UI manager