Clean up logic in row selection