Compact folded waveguides