Generalize mechanism handling branches to support switches over unknowns + fixes