Refactoring of the whole library