Partial refactoring.
reverted lib.