add segment functionality