refactored library