1) cleanup
2) added a bunch more unit tests