collapse if/if into if/elif