Refactors the whole library