Simplified if/else code