Refactor switches