added logic to toolbar handler