Stacking code for caustic technique