Dialog toolbar implementation and refactoring