refactoring learning_switch