Added code to produce the right sequence