better refactoring with library