library refactor