Code cleanup, improvements and comments
Refactor switch statement into a Hashmap with explanation