Optimize if/else statements