major library refactoring