Updated with some working unit tests.