Refactored internals.