more complete test suite; some refactoring around shared methods