Consolidated decision structure and made code more visually coherent.