titlebar: commented and refactored