Now fully debugged the negatives generation algorithm, added unit tests.