added sequence checking