Collapse redundant code