Library Code Refactoring