Library refactoring