added some tests and fixed a few corner case bugs
4 files changed