replace some if/then/else by guards