started an alternative sequence generation algorithm that uses objects rather than if-then-else