refactored a bit of the UI manager to reduce coupling