Lam = beta;
Rd = Pis/beta;
RF = (1+sp)^(1/4)*Rd;
RB = Deltas*(RF - Rd) + Rd;
QF = (RF - kappaf)^(-1);
QB = (RB - kappab)^(-1);
RLF = QF^(-1) + kappaf;
RLB = QB^(-1) + kappab;
QEH = (Rd - kappab)^(-1);
RLEH = QEH^(-1) + kappab;
infl = Pis;
M2 = Lam*Pis^(-1)/(QF*(1-kappaf*Lam*Pis^(-1)));
M = (M2-1)*psi+1;
pm = (epsip-1)/epsip;
%pm = (epsip-1)/epsip; % steady state marginal cost
K = (alpha*pm/(M/Lam - (1-delta0)*M))^(1/(1-alpha));
Ym = K^(alpha);
w = pm*(1-alpha)*K^(alpha);
Ih = delta0*K;
I = Ih;
Y = Ym;
G = Gs;
C = Y - I - G -rotemberg/2*(Pis-1)^2*Y;
wr = (w^(1-epsiw)*(1-phiw*Pis^((1-epsiw)*(gammaw-1)))/(1-phiw))^(1/(1-epsiw)); % reset wage
mrs = ((epsiw-1)/epsiw)*wr*(1-phiw*Lam*Pis^(epsiw*(1-gammaw)))/(1-phiw*Lam*Pis^((1-epsiw)*(gammaw-1)));
vw = (1-phiw)*(wr/w)^(-epsiw)/(1-phiw*Pis^(epsiw*(1-gammaw)));
L = vw;
mu = (1/C)*(1/(1-bh) - beta*bh/(1-bh));
f1 = mrs*w^(epsiw)/(1-phiw*Lam*Pis^(epsiw*(1-gammaw)));
f2 = w^(epsiw)/(1-phiw*Lam*Pis^((1-epsiw)*(gammaw-1)));
fpr = psi*Ih/(QF*(1-kappaf*Pis^(-1)));
fcb = fcbs;
bcb = bcbs;
bG = bGs;
phi = phis;   
theta = thetas;
re = QF*fcb + QB*bcb;
f = fpr - fcb;
b = bG - bcb;
n = (QF*f + QB*b + re)/levs;
d = QF*f + QB*b + re - n;
a = theta*phi;
Omega = 1-sigma + sigma*a;
lam = ((theta/((RF - Rd)*Lam*Omega*Pis^(-1))) - 1)^(-1);
returnf = RF - Rd;
returnb = RB - Rd;
returnfb = RF-RB;
phi_1 = Rd*Pis^(-1)*Lam*Omega;
phi_2 = theta - (RF-Rd)*Pis^(-1)*Lam*Omega;
RE = Rd;
omega = (Rd - RE)*(1+lam)/Pis*Lam*Omega;
Tcb = (1+kappaf*QF)*Pis^(-1)*fcb + (1+kappab*QB)*Pis^(-1)*bcb - RE*Pis^(-1)*re;
T = G + bG*Pis^(-1) - Tcb - QB*(bG - kappab*Pis^(-1)*bG);
spreadf = log(RLF) - log(Rd);
spreadb = log(RLB) - log(Rd);
RTR = Rd;
welf = (log(C - bh*C) - psi*L^(1+eta)/(1+eta))/(1-beta);

ys = [ log(RF);
    log(QF);
    log(RB);
    log(QB);
    log(RE);
    log(Rd);
    log(infl);
    log(Lam);
    Omega;
    lam;
    a;
    log(phi);
    log(mu);
    log(C);
    log(L);
    log(mrs);
    log(wr);
    f1;
    f2;
    log(w);
    log(Ld);
    log(pm);
    log(Y);
    log(Ym);
    log(u);
    log(K);
    log(pk);
    log(M);
    log(Ih);
    log(fpr);
    log(I);
    log(G);
    log(bG);
    T;
    Tcb;
    fcb;
    bcb;
    re;
    vw;
    log(f);
    log(b);
    log(d);
    log(n);
    log(RLF);
    log(RLB);
    log(QEH);
    log(RLEH);
    0;
    0;
    0;
    0;
    log(thetas);
    log(Deltas)
    returnf
    returnb
    returnfb
    phi_1
    phi_2
    omega
    spreadf
    spreadb
    log(RTR)
    log(RLF)-log(infl)
    log(RLB)-log(infl)
    log(M2);
    Y;
    G;
    0;
    welf];