Refactoring of library