add condition handling