remove the switch statement in favor of a more functional approach
pass in the caption element into the case functions to make them less brittle
remove variable group declaration at top of applyClasses function because only 1 variable is being declared.