Some refactoring and added toolbar.