broke out giant switch statement into its own method
simplified the casting with implicits