Reorder if/else check