this code belongs to sequence class