shift register based version