restructure a block to reduce nesting