refactored add segements