Fixed examples, added unit tests