small changes to handle the selection action.