Topic/match to if then else

Not sure about the last commit. But then again it was buggy before too :-)