Refactor to separate sequence generation from stringification.