Replace switch statement with a map
Reduced complexity