updated tip logic