Clean things up by removing the "switch nonsense"

Although really, it is just a switch of a different sort. This
implementation takes the switch statement and encodes it as an Object
that then is used to select which function to execute based on the key
name.