optimize for sequence command; add some comments