Made the refactoring for the library