move generateSequence to new file, add test