Refactoring after code review.
Added test method (test keeping 20 last segments only).