Fixes some errors caused by the refactoring and moves the toolbar buttons functionality to the UI module.