Refactored tcp input segments to save ram.