refactored toolbar button and implemented some events.