Large multiple "if" optimisation