Refactored library