Refactore for easy exchanging the switch logic