spl: one function for switch and output