change the logic to select cell