some work on sequence, some case cleanup, some refactoring