Refactored Segements with Factory Class