Added logic to the Selection event