Working two-layer version