Remove duplication of conditional test