Refactored library code.