Refactored conditional branching