major refactoring of library, without tests
scan test
Changes recovered from corrupted repository