switching logic for clarity