Convert to if/else chain