rewrited to fit new sequence api