improved repeated condition check