Make valueFun return a non-optional, then we can lose the massive switch/case.