Clean up esn code.