Add tests and fix some small bugs in extractors