refactor titlebar structure