Refactor navbar events