These control structures are too deeply nested. This should be refactored.